package messiah.manager.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import messiah.dao.dataobject.SmsSendsDO;
import messiah.dao.mapper.SmsSendsMapper;
import messiah.manager.interfaces.ISmsSendsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Service
public class SmsSendsServiceImpl implements ISmsSendsService {

    @Autowired
    private SmsSendsMapper smsSendsMapper;

    @Override
    public List<SmsSendsDO> getList() {

        QueryWrapper<Object> objectQueryWrapper = Wrappers.emptyWrapper();

        objectQueryWrapper.select("*");


        List<SmsSendsDO> smsSendsDOS = smsSendsMapper.selectList(Wrappers.emptyWrapper());

        return smsSendsDOS;
    }

    @Override
    public IPage<SmsSendsDO> getPageList(int pageNum, int pageSize) {
        IPage<SmsSendsDO> page = new Page<>();
        page.setSize(pageSize);
        page.setPages(pageNum);

        Wrapper<SmsSendsDO> wrapper = Wrappers.emptyWrapper();
//        wrapper.clear();

        IPage<SmsSendsDO> smsSendsDOIPage = smsSendsMapper.selectPage(page, wrapper);

        return smsSendsDOIPage;
    }
}
